; Try to use Java to get some reasonable defaults:

(define get-matches
	(lambda (str ppairs)
		(let ((matches '()))
  (for-each (lambda (spair)
              (set! matches (append matches (list (substring str (car spair)(cdr spair))) )))
            ppairs)
  matches)))
   
(define parse-content
	(lambda (content pattern)
	(let iter ((match-pairs (pregexp-match-positions pattern content)) (sstr content) (res '()))
		(if (not match-pairs) res
	    	 (let ((subs (substring sstr (cdr (list-ref match-pairs 0)) (string-length sstr))))
			(iter (pregexp-match-positions pattern subs) subs (append res (list (get-matches sstr (list-tail match-pairs 1)))))
		))
)))
(define parse-content-with-pre_proc
	(lambda (content pattern pre-pattern replace-with) 
		(parse-content (pregexp-replace* pre-pattern content replace-with) pattern)))
	
;; according 'pattern',pare the conten of 'url' to a list of data(list of list)
(define parse-url
	(lambda (url pattern) (parse-content (brl-url-contents url) pattern)))

(define parse-url-with-pre_proc
	(lambda (url pattern pre-pattern replace-with) (parse-content-with-pre_proc
	 (brl-url-contents url) pattern pre-pattern replace-with)))
